
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加员工信息</title>
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="${WEB_PATH}/resources/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/bootstrap-table/bootstrap-table.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/bootstrap-table/bootstrap-editable.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/style.min.css?v=5.0.0" rel="stylesheet"><base target="_blank">
	<link href="${WEB_PATH}/resources/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
	<link href="${WEB_PATH}/resources/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
	<link href="${WEB_PATH}/resources/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
	
</head>

<style>
.chosen-single.chosen-default.error {
    border: 1px solid #fbc2c4;
    background: rgb(251, 227, 228);
    /* color: #8a1f11; */
}
</style>
<body>
	<div class="col-sm-12">
		<form class="m-t" id="editform">
			  <input  name="ID"   value="${testPersonnelInfo.ID}"  type="hidden">
	    		 <div class="row">
	    		 	<div class="col-sm-6"> 
	                    <div class="form-group">
	                        <label>所属检验机构：</label>
	                         <select data-placeholder="选择所属检验机构" id="JYJGID" name="JYJGID"  class="chosen-select form-control" >
	                                      <option  value="" hassubinfo="true" ></option>
		                       <#list list as org >
						              <option value="${org.ID}" hassubinfo="true" <#if testPersonnelInfo.JYJG.JYJGBH = org.JYJGBH> selected="selected" </#if> >${org.JYJGMC}</option>
						       </#list>
							  </select>
	                    </div>
	                </div>
	     		
	             </div>
	             <div class="row">
	             	<div class="col-sm-6">
	                    <div class="form-group">
	                        <label>姓名：</label>
	                        <input name="XM" id="XM"   type="text"  class="form-control" placeholder="请输入姓名" value="${testPersonnelInfo.XM}">
	                    </div> 
	                </div>
	             	  <div class="col-sm-6">
	                    <div class="form-group">
	                        <label>性别：</label>
	                          <select data-placeholder="请选择性别" id="XB" name="XB"  class="chosen-select form-control" >
	                          	<option  value="" hassubinfo="true" ></option>
							    <option value="男" <#if testPersonnelInfo.XB = '男'> selected="selected" </#if> hassubinfo="true">男</option>
							    <option value="女" <#if testPersonnelInfo.XB = '女'> selected="selected" </#if> hassubinfo="true">女</option>
							  </select>
	                    </div> 
	                </div>
	                
	             </div>
	              <div class="row">
	               <div class="col-sm-6">
	                    <div class="form-group">
	                        <label>身份证号码：</label>
	                        <input  name="SFZBH" id="SFZBH"   type="text"  class="form-control" placeholder="请输入身份证号码" value="${testPersonnelInfo.SFZBH}">
	                    </div> 
	                </div>
	                 <div class="col-sm-6">
	                    <div class="form-group">
	                        <label>出生日期：</label>
	                        <input  name="CSRQ" id="CSRQ"   type="text"  class="form-control" value="${testPersonnelInfo.CSRQ}" readonly>
	                    </div> 
	                </div>
	             </div>
	              <div class="row">
	               <div class="col-sm-6">
	                    <div class="form-group">
	                        <label>文化程度：</label>
	                        <input  name="WHCD" id="WHCD"   type="text"  class="form-control" placeholder="请输入文化程度" value="${testPersonnelInfo.WHCD}">
	                    </div> 
	                </div>
	                  <div class="col-sm-6">
	                    <div class="form-group">
	                        <label>所在岗位：</label>
	                          <select data-placeholder="请选择所在岗位" id="SZGW" name="SZGW"  class="chosen-select form-control" >
	                          	<option  value="" hassubinfo="true" ></option>
							    <option value="站长"   <#if testPersonnelInfo.SZGW = '站长'> selected="selected" </#if> hassubinfo="true">站长</option>
							    <option value="技术负责人"  <#if testPersonnelInfo.SZGW = '技术负责人'> selected="selected" </#if>  hassubinfo="true">技术负责人</option>
							    <option value="质量负责人"  <#if testPersonnelInfo.SZGW = '质量负责人'> selected="selected" </#if> hassubinfo="true">质量负责人</option>
							    <option value="外检"  <#if testPersonnelInfo.SZGW = '外检'> selected="selected" </#if> hassubinfo="true">外检</option>
							    <option value="登录员"  <#if testPersonnelInfo.SZGW = '登录员'> selected="selected" </#if> hassubinfo="true">登录员</option>
							    <option value="驾控员"  <#if testPersonnelInfo.SZGW = '驾控员'> selected="selected" </#if> hassubinfo="true">驾控员</option>
							    <option value="其它"  <#if testPersonnelInfo.XB = '其它'> selected="selected" </#if> hassubinfo="true">其它</option>
							  </select>
	                    </div> 
	                </div>
	             </div>
	             <div class="row">
	             	  <div class="col-sm-6">
	                    <div class="form-group">
	                        <label>上岗日期：</label>
	                        <input  name="SGRQ" id="SGRQ"   type="text"  class="form-control" value="${testPersonnelInfo.SGRQ}" readonly>
	                    </div> 
	                </div>
	                <div class="col-sm-6">
	                    <div class="form-group">
		                    <label >状态：</label>
		                    <div class="col-sm-4 form-control">
		                        <div class="radio radio-success radio-inline">
		                           <input type="radio"  value="ONGOING" name="RYZT" id="JCXZD1" <#if testPersonnelInfo.RYZT = 'ONGOING'> checked="" </#if>>
		                           <label for="JCXZD1">在岗</label>
		                        </div>
		                        <div class="radio radio-warning radio-inline">
		                            <input type="radio"  id="JCXZD2" value="OUTGOING" name="RYZT" <#if testPersonnelInfo.RYZT = 'OUTGOING'> checked="" </#if>>
		                            <label for="JCXZD2">离职</label>
		                        </div>
		                    </div>
		                </div> 
	                </div>
	             </div>
        </form> 
		</div>
	</div>
    <script src="${WEB_PATH}/resources/js/jquery.min.js?v=2.1.4"></script>
    <script src="${WEB_PATH}/resources/js/ajax.extend.js"></script>
    <script src="${WEB_PATH}/resources/js/bootstrap.min.js?v=3.3.5"></script>
	<script src="${WEB_PATH}/resources/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/wizard/jquery.bootstrap.wizard.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/messages_zh.min.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/jquery.validate.method.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/layer/layer.js"></script> 
	 <script src="${WEB_PATH}/resources/js/city-picker.data.js"></script>
	<script src="${WEB_PATH}/resources/js/city-picker.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/sweetalert/sweetalert.min.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/chosen/chosen.jquery.js"></script>
	 <script>
	$(function(){
	    //开通日期
    	$("#CSRQ").datepicker({
	        keyboardNavigation: !1,
	        forceParse: !1,
	        autoclose: !1
	    });
	    
	   $("#SGRQ").datepicker({
	        keyboardNavigation: !1,
	        forceParse: !1,
	        autoclose: !1
	    });
	    
	  
	    
	    $("#JCFFIDS").chosen({width:'100%'});
	    $("#JYJGID").chosen({width:'100%'}); 
	    $("#XB").chosen({width:'100%'});
	    $("#SZGW").chosen({width:'100%'});  
	    
	    
    });
	var e = "<i class='fa fa-times-circle'></i> ";
	var $editformvalidate =  $('#editform').validate({
	      ignore:".ignore",
		  rules: {
		    JYJGID: {
		      required: true
		    },
		     XM:{
		        required: true,
		    },
		    XB: {
		      required: true
		    },
		    SFZBH: {
		      required: true
		    },
		    CSRQ:{
		      required: true
		    }, 
		    WHCD:{
		      required: true
		    },
		    SZGW:{
		      required: true
		    }, 
		    SGRQ:{
		      required: true
		    } 
		  },
		  messages: {
            JCXMC: {
                remote:e+"检测线名称已存在，请重新输入！"
            }
          },
		  errorPlacement: function(error, element) {
		      if(element.get(0).id == "JYJGID"){
		     		if($("#JYJGID").val()==null||$("#JYJGID").val()==""){
		     			element.next().find("a.chosen-default").addClass("error");
		     		}
            	}
                if(element.get(0).id == "XB"){
		     		if($("#XB").val()==null||$("#XB").val()==""){
		     			element.next().find("a.chosen-default").addClass("error");
		     		}
            	}
            	if(element.get(0).id == "SZGW"){
		     		if($("#SZGW").val()==null||$("#SZGW").val()==""){
		     			element.next().find("a.chosen-default").addClass("error");
		     		}
            	}
            	element.before(error);
            	element.before(error);
          },
          success:function(element){
             if(element.prop("tagName")=='SELECT'){
		          console.log(element);
		     }
	         
	      }
	});
     //添加检测线信息#addForm
 	function saveEditForm(){
 		if($('#editform').valid()){
 			 var addformJson = $('#editform').serializeJson();
			 $.yilinAjax({
		   	  	type:'POST',
		   	  	loadmsg:'努力提交中......',
		   	  	url:'${WEB_PATH}/reg/personnel/edit.do',
		   	  	data:addformJson,
		   	  	btn:null,
        		errorcallback:null,
        		successcallback:success
		   	 });
    	}
 	}
 	
 	function success(result){
 		if(result.success == true){
	    	layer.alert('<font color="#1ab394">'+result.msg+'</font>', {
			  	skin: 'layui-layer-molv',
			  	icon: 1,
			  	closeBtn: 0
			},function(){
				parent.$("#exampleTableEvents").bootstrapTable('refresh');
				var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
				parent.layer.close(index); 
			});
		}else{
			$('#saveBut').attr("disabled",false); 
		 	$('#subBut').attr("disabled",false);       
	    	layer.alert('<font color="red">'+result.msg+'</font>', {
			  skin: 'layui-layer-molv' ,
			  closeBtn: 0,
			  icon: 5,
			});
		}
 	}
  </script>
</body>
</html>